const getGoodsList = require('./getGoodsList/index');
const getGoods = require('./getGoods/index');
const getCount = require('./getCount/index');
const getGoodsByClient = require('./getGoodsByClient/index');

// 云函数入口函数
// event：获取前端传递的所有数据
exports.main = async (event, context) => {
  // 根据前端传递的 type 字段进行分发
  switch (event.type) {
    case 'getGoodsList':
      return await getGoodsList.main(event, context);
    case 'getGoods':
      return await getGoods.main(event, context);
    case 'getCount':
      return await getCount.main(event, context);
    case 'getGoodsByClient':
      return await getGoodsByClient.main(event, context);
  }
};
